package org.me.nyx.activities;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import org.me.nyx.R;
import org.me.nyx.domain.Movie;

public class ViewMovie extends Activity {
	Movie movie;

	TextView name;
	TextView description;
	TextView rating;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.view_movie);

		name = (TextView) findViewById(R.id.movie_name);
		rating = (TextView) findViewById(R.id.movie_rating);
		description = (TextView) findViewById(R.id.movie_description);
		load();
    }

	public void load() {
		int movieId = getIntent().getIntExtra("movie", 0);
		for (Object object : Movie.list)
		{
			Movie m = (Movie) object;
			if (m.getId() == movieId)
				movie = m;
		}

		name.setText(movie.getName());
		rating.setText(movie.getRating() + " / 10");
		description.setText(movie.getDescription());
	}

    @Override
    public void onDestroy() {
    	super.onDestroy();
    }
}
